package com.guli.vodtest;

import com.aliyun.vod.upload.impl.UploadVideoImpl;
import com.aliyun.vod.upload.req.UploadVideoRequest;
import com.aliyun.vod.upload.resp.UploadVideoResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.vod.model.v20170321.*;
import com.sun.org.apache.bcel.internal.generic.NEW;


/**
 * @author zxc
 * @date 2023/04/08 15:28
 **/
// CreateUploadVideo : 本接口仅用于获取上传地址和凭证以及创建媒资基础信息，并非上传文件
public class VodDemo2 {
    public static void main(String[] args) throws ClientException {
        // 根据视频id，来获取上传音视频地址
        // 1.创建初始化HttpClient对象
        DefaultAcsClient client = VodInit.initVodClient("LTAI5tGoduzd9bgBczsfeL6K", "Bggqknbss9p7o5lUE6sEvVZc3ZuwoL");

        // 2.创建获取音视频地址的request && response;
        CreateUploadVideoRequest request = new CreateUploadVideoRequest();
        CreateUploadVideoResponse response = new CreateUploadVideoResponse();

        // 3.向request对象中，设置参数值
        request.setTitle("TestVideo - 1");
        request.setFileName("F:\\Java项目\\学院\\项目资料\\1-阿里云上传测试视频\\6 - What If I Want to Move Faster.mp4");

        // 4.调用client对象中所封装的方法，以request作为参数进行传递，使用response来接收所产生结果;
        response = client.getAcsResponse(request);
        // 获取response中所存储的数据
        System.out.print("VideoId = " + response.getVideoId() + "\n");
        System.out.print("UploadAddress = " + response.getUploadAddress() + "\n");
        System.out.print("UploadAuth = " + response.getUploadAuth() + "\n");
        System.out.print("RequestId = " + response.getRequestId() + "\n");


    }
}
